<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('hotel_images', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('hotel_id')->default(0)->comment('酒店ID');
            $table->boolean('type')->default(0)->comment('类型：1酒店图');
            $table->unsignedInteger('cat_id')->default(0)->comment('分类ID');
            $table->string('image')->default('')->comment('图片');
            $table->unsignedInteger('sort')->default(0)->comment('排序');
            $table->dateTime('created_at')->default(\DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('updated_at')->default(\DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
        });
        DB::statement("ALTER TABLE `hotel_images` COMMENT '酒店相册'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (!is_production()) Schema::dropIfExists('hotel_images');
    }
};
